from elasticsearch import Elasticsearch

es = Elasticsearch("http://39.108.176.217:9200")
index_name = "my_index"
es.indices.create(index=index_name, ignore=400)
print("create my_index success")
doc = {
    "title": "22_python实战elasticsearch",
    "author": "zxp_3",
    "content": "elasticsearch是一个功能强大的搜索引擎_3"
}
es.index(index=index_name, document=doc)
print("添加文档到指定index成功")
